package it.scambiocorse.dao;

import it.scambiocorse.model.AutistaType;
import it.scambiocorse.model.ClienteType;
import it.scambiocorse.model.ServizioType;
import it.scambiocorse.model.SorgenteType;
import it.scambiocorse.utils.Utils;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Types;

import org.springframework.jdbc.core.PreparedStatementCreator;

import com.mysql.jdbc.Statement;

public class PSCCliente implements PreparedStatementCreator {
	
private ClienteType a;
private String sql;

PSCCliente () {}
PSCCliente (ClienteType a, String sql) {
	this.a = a;
	this.sql = sql;
}
PSCCliente (ClienteType a) {
	this.a = a;
}

	public PreparedStatement createPreparedStatement(Connection connection) throws SQLException {
		String sql = "insert into cliente_tab (id_user_inse, desc_nome, tel, email, data_inse) values(?,?,?,?,?)";
		
		PreparedStatement ps = connection.prepareStatement(sql,Statement.RETURN_GENERATED_KEYS);
		ps.setInt(1, a.getIdUser());
		ps.setString(2, a.getDescNome());
		ps.setString(3, a.getTelefono());
		ps.setString(4, a.getEmail());
		ps.setTimestamp(5, Utils.getSysDate());

		
		
	return ps;
	}
}
